/*
 * @Author: xuwejie 1529315455@qq.com
 * @Date: 2023-08-26 15:32:36
 * @LastEditors: xuwejie 1529315455@qq.com
 * @LastEditTime: 2023-09-06 16:20:47
 * @FilePath: \school-shop-vue\store\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
//引入vue和vuex
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({//全局变量定义
  state: {
    // 供应商
    companyData: [],
    // 供应商信息
    companyInfo: JSON.parse(sessionStorage.getItem('changeCompanyInfo')) || null,
    // 分类数据
    classfi: null,
    // 选择的分类下标
    currents: null,
    // 审核状态
    type: null,
    // 店铺id,
    company: null,

    // 电话
    tel: null,
    //优惠券
    getSubOrdCou: null,

    currentRoute: null
  },
  mutations: {
    changeCompanyInfo(state, data) {
      state.companyInfo = data
      sessionStorage.setItem("changeCompanyInfo", JSON.stringify(data));
    },
    changeClassfi(state, data) {
      state.classfi = data
    },
    changeCurrent(state, data) {
      state.currents = data
    },
    changeType(state, data) {
      state.type = data
    },
    changeCompanyData(state, data) {
      state.companyData = data
    },
    changeCompany(state, data) {
      state.company = data
    },
    changeTel(state, data) {
      state.tel = data
    },
    changeGetSubOrdCou(state, data) {
      state.getSubOrdCou = data
    },
    changeCurrentRoute(state, data) {
      state.currentRoute = data
    },

  }
})
export default store